<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:set  var="u" value="@com.tank.util.TankUtil@getCurrentUser()"></s:set>
<s:set  var="schools" value="@com.tank.util.TankUtil@getSchools()"></s:set>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">

<title>  ichange - 个人设置2</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="T1his is my page">

<jsp:include page="../skin/jsp/files.jsp"></jsp:include>

<link href="./skin/setting_files/profile_setting.css" rel="stylesheet"
	type="text/css">
<link href="./skin/setting_files/pwd_setting.css" rel="stylesheet"
	type="text/css">

<script type="text/javascript" charset="utf-8"
	src="./skin/setting_files/less-1.3.0.min.js">
	
</script>
<link href="./skin/setting_files/wokaobox.css" rel="stylesheet"
	type="text/css" media="screen">

  <!-- s -->
  <script type='text/javascript' src='/dwr/engine.js'></script>
  <script type='text/javascript' src='/dwr/interface/USER.js'></script>


</head>
<link rel="stylesheet" type="text/css" href="data:text/css,">

<body>


	
	<script src="zgg/js/jquery.upload-1.0.2.js"></script>
	
	<jsp:include page="header.jsp"></jsp:include>


	<!--end header-->
	<div id="content" class="cf">
		<div id="left_content">
			<dl>
				<dt>我的设置</dt>
				<dd>
					<ul>
						<li><a href="setting#setting-info"
							class="erji_nav_click">基本资料</a></li>
						<li><a href="setting#setting-pwd"
							class="erji_nav">密码设置</a></li>
					</ul>
				</dd>
			</dl>
		</div>
		<!--end left_content-->

		<div id="right_content">
			<h2 id="setting-info">基本资料  ${u.name}</h2>

			<!-- <form action="/settings/info" method="post"
				id="form"> -->

				<div class="user-img">
					<div class="user-upload">


						<p style="padding-bottom:40px;" id="panel_upload">
							<input type="file" name="face" id="inp_upload">
						</p>


						<span><a id="btn_toggle_upload" href="javascript:void(0);">上传头像
						</a> </span>
						<div class="upload-bg-wrap">
							<div class="upload-bg"></div>
						</div>
					</div>
					<div class="upload-imgs">
						<img id="face"
							src="${u.photo}"
							width="120" height="120">
						<p>大头像尺寸120×120</p>
					</div>
				</div>

				<div class="item-wrap">
					<div class="item">
						<label for="account"> 帐号： </label> <span class="show_info">
							${u.name}</span>
					</div>

					<div class="item">
						<label for="nickname"> 邮箱： </label> <span class="fl"> <span
							id="showNickname" class="show_info">${u.mail}</span>
							<a id="nicknameEdit" href="javascript:void(0);"
							class="edit_info">重新设定</a> 
					</div>
					<div class="item cb">
						<label  > 学校： </label> <select
							style="float: left; BORDER: #CCCCCC 1px solid; FONT-SIZE: 12px; COLOR: #003366; BACKGROUND-COLOR: #fffff; width: 300px; height: 27px; margin-top: 8px;"
							id="school"
							data='${u.school.id}'
							>
						   <s:iterator value="schools"><option value="${id}">${name}</option></s:iterator>
							</select>
					</div>

					<div class="item cb">
						<label  > 地址： </label>  <input
							style="float: left; BORDER: #CCCCCC 1px solid; FONT-SIZE: 12px; COLOR: #003366; BACKGROUND-COLOR: #fffff; width: 300px; height: 25px; margin-top: 8px;"  name="home"  id="home" value="${u.home}"/>

					</div>

	  


					<div class="item last-item">
						<label for="introduction"> 个人简介：</label>
						<textarea name="intro" id="intro"
							class="area-input text-input" maxlength="140">${u.intro}</textarea>
						<span
							class="intro-tip fr">（限140字以内）</span>
					</div>
					
				</div>
				<input id="btnBasic" type="submit" class="save_btn" value="保  存"
					style="margin-bottom: 30px;">
				

				
			<!-- </form> -->


			<script  type="text/javascript">
			<!--
			$(function (){
					var data=$('#school').attr('data');
					$('#school option[value='+data+']').attr('selected','selected');
					
					$('#btnBasic').click(function (){
						var home=$('#home').val();
						var intro=$('#intro').val();
						var schoolid=$('#school option:selected').val();
					
						var user={'home':home,'intro':intro,'school':{id:schoolid}};
						USER.modifyBasic(user,function (tm){
							
							if(tm){
								alert(tm.message);
							}
						});

						return false;
					
					});
			
			
			
			
			
			
			
			});
			//-->
			</script>



			<div class="right_content" id="setting-pwd">

				<h2>密码设置</h2>

					<div class="wrap">

						<div>

							<label for="oldPassword">旧密码:</label> <input type="password"
								name="oldPassword" id="oldpass" tabindex="1"
								class="required" maxlength="16" />

						</div>



						<div>

							<label for="newPassword">新密码:</label> <input type="password"
								name="newPassword" id="newpass" tabindex="2"
								class="required" maxlength="16" />

						</div>



						<div>

							<label for="confirmPassword">确认密码:</label> <input type="password"
								name="confirmPassword" id="repass" tabindex="3"
								class="required" maxlength="16" />

						</div>



					</div>



					<input type="submit"  id="btnPass" class="save_btn" value="保 存" tabindex="4" /> <br
						clear="all"></br>

					<script  type="text/javascript">
			<!--
			$(function (){
			
					
					$('#btnPass').click(function (){
						var oldpass=$('#oldpass').val();
						var newpass=$('#newpass').val();
						var repass=$('#repass').val();
						
						$('#newpass').val('');
						$('#repass').val('');
						$('#oldpass').val('');

						if(newpass !=repass ){
							alert('双次填写的新密码不一致!');
							return false;
						}else if(newpass.length <1){
							alert('新密码长度不能小1!');
							return false;
						}else if(oldpass.length <1){
							alert('原密码必填!');
							return false;
						}
						
						USER.modifyPass(oldpass,newpass,function (tm){
							if(tm){
								alert(tm.message);
							}
						});

						return false;
					
					});
			
			
			
			
			
			
			
			});
			//-->
			</script>



			</div>
			<!--end right_content-->

			<div class="cb"></div>

		</div>
		<!--end content-->



	

	</div>
	<!--end right_content-->

	<div class="cb"></div>

	<br>
	</div>
	<!--end content-->
<script type="text/javascript">
					<!--
						$('#inp_upload').hide();
						$('#btn_toggle_upload').click(function() {
							$('#inp_upload').toggle();
							$(this).blur();
						});

						$('input[type=file]')
								.change(
										function() {
											$(this)
													.upload(
															'faceUpload?author.id=${u.id}',
															function(res) {
																//alert('File uploaded'+res);
																$('#inp_upload')
																		.hide();
																$('#face')
																		.attr(
																				'src',
																				'zgg/face/'
																						+ res.faceFileName);
															}, 'json');
										});
					//-->
					</script>

		<jsp:include page="../skin/jsp/footer.jsp"></jsp:include>
<script type="text/javascript">
       jQuery.global.init();</script>



</body>
</html>